ASIO: provide bufferSwitchTimeInfo instead of leaving it NULL - #486
Merged
garyscavone merged 1 commit intoAug 18, 2026
Merged
Conversation
RtApiAsio installed three of the four ASIO host callbacks and set asioCallbacks.bufferSwitchTimeInfo to NULL. Any driver that calls it therefore transfers control to address 0 and takes the process down. asioMessages() answers kAsioSupportsTimeInfo with 0, so by the letter of the SDK a driver should use bufferSwitch instead. Steinberg's Generic Low Latency ASIO driver calls bufferSwitchTimeInfo regardless, crashing on the first ASIOStart(). Removing kAsioSupportsTimeInfo from the kAsioSelectorSupported list as well does not help, so it consults neither answer. Since the host cannot control how a third-party driver behaves, and a call through a null function pointer is unrecoverable, supply the callback and forward it to bufferSwitch. The time info is not used. Fixes thestk#485. Very likely the root cause of thestk#409, and possibly thestk#443.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #485, with the full diagnosis there. Very likely the root cause of #409
("Unstable ASIO support?"), and possibly #443.
RtApiAsio::probeDeviceOpeninstalls three of the four ASIO host callbacks and leaves thefourth null:
Any driver that calls
bufferSwitchTimeInfotherefore transfers control to address 0 andtakes the process down. Steinberg's Generic Low Latency ASIO driver (
asioglld.dll) doesthis on the first
ASIOStart().asioMessages()answerskAsioSupportsTimeInfowith0, so by the letter of the SDK adriver should fall back to
bufferSwitch. This one does not, and removingkAsioSupportsTimeInfofrom thekAsioSelectorSupportedlist as well does not help either— it consults neither answer. Since the host cannot control how a third-party driver
behaves, and a call through a null function pointer is unrecoverable, the only robust option
is to supply the callback.
This is why #409's crash appears at
theAsioDriver->start(): that frame is where itsurfaces, but
ASIOStart()null-checks the driver pointer one line earlier. The fault is inthe driver calling back into a null host callback, so the faulting frame belongs to the
driver rather than to RtAudio.
The change
Forward
bufferSwitchTimeInfoto the existingbufferSwitch; the time info is unused.Three hunks: two forward declarations, the new function next to
bufferSwitch, and theassignment.
Verified
of them selecting ASIO, each with a live stream — no crash. Without the change the process
dies on the first or third ASIO selection with
0xC000041D(
STATUS_FATAL_USER_CALLBACK_EXCEPTION), from an access violation with the instructionpointer at
0x0.RtAudio.cppcompiles clean at this branch's HEAD with__WINDOWS_ASIO__, MSVC 14.51,/std:c++17— no new warnings.Environment: Windows 11 Pro 10.0.26200 x64, Steinberg Generic Low Latency ASIO Driver
1.0.30.15.
Found while working on the standalone host in
free-audio/clap-wrapper, where "switching from
WASAPI to ASIO crashes" was on our own bug list until it turned out to be this.
Happy to adjust — for instance if you would rather pass the real
ASIOTimethrough tocallbackEvent()than discard it, though that is a larger change than stopping the crashneeds.